package com.crm.service.impl;

import com.crm.domain.entity.UserRole;
import com.crm.mapper.UserRoleMapper;
import com.crm.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户角色业务层实现类
 */

@Service
public class UserRoleServiceImpl implements UserRoleService {

    @Autowired
    private UserRoleMapper userRoleMapper;

    @Override
    public Integer add(UserRole userRole) {
        return userRoleMapper.insert(userRole);
    }

    @Override
    public void deleteByUserId(Integer userId) {
        userRoleMapper.deleteByUserId(userId);
    }

    @Override
    public List<Integer> findRoleIdByUserId(Integer userId) {
        return userRoleMapper.findRoleIdByUserId(userId);
    }
}
